package com.ragdollcat.thirdaicodegenerate.config;

import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import lombok.Data;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * deep seek 普通模型配置类
 */
@Configuration
@ConfigurationProperties("langchain4j.open-ai.chat-model")
@Data
public class ChatModelConfig {

    private String apiKey;

    private String baseUrl;

    private String modelName;

    private Boolean logRequests;

    private Boolean logResponses;

    private Integer maxTokens;


    @Bean
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public ChatModel commonChatModel() {
        return OpenAiChatModel.builder().
                apiKey(apiKey).
                baseUrl(baseUrl).
                modelName(modelName).
                logRequests(logRequests).
                logResponses(logResponses).
                maxTokens(maxTokens).
                build();
    }


}
